def is_prime(num):
    if num < 2:
        return False
    for i in range(2, int(num ** 0.5) + 1):
        if num % i == 0:
            return False
    return True

def find_closest_prime_number(num):
    if num < 100 or num > 999:
        print("wrong input")
        return
    while not is_prime(num):
        num += 1
    print(num)

input_words = input("Enter three words separated by space: ").split()
number_dict = {
    "zero": 0, "one": 1, "two": 2, "three": 3,
    "four": 4, "five": 5, "six": 6, "seven": 7,
    "eight": 8, "nine": 9
}

number = 100 * number_dict.get(input_words[0], -1) + 10 * number_dict.get(input_words[1], -1) + number_dict.get(input_words[2], -1)
find_closest_prime_number(number)
